// tadolist函数方式

import {useState} from 'react'

const Search2 = (props) => {

  const [use,setuser] = useState({
    name:''
  })

  //内容输入
  let content2 = (e) => {
    setuser({
      ...use,name: e.target.value
    })
  }

  // 确认按钮
  let affirm = () => {
    // console.log(props.todolist2(use.name));
    let {name} = use
    props.todolist2({name})
  }

  return (
    <>
      <div className='top'>
        <h1 className='h1'>拾忆记事本</h1>
        <div className='jilu'>记录生活点点滴滴，写下生活每一个美好</div>
        <div className='inp'>
          <div className='nei'>内容</div>
          <input className='input3' type="text" value={use.nmae} onChange={content2} />
          <div className='nei2' onClick={() =>affirm(use)}>确认</div>
        </div>
      </div>
    </>
  )

}

export default Search2
